]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Use the count to display the number of unread notifications
authorJasper St. Pierre <jstpierre@mecheye.net>
Fri, 24 Jun 2011 19:47:24 +0000 (15:47 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Wed, 6 Jul 2011 22:43:39 +0000 (18:43 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=649356

js/ui/messageTray.js

index dd4049f1902c41bc971744ecabcfa8ddf6aa58a4..a29dedebd88ef4a4d8b9db7bbf8baa9cb682cf37 100644 (file)
@@ -948,6 +948,11 @@ Source.prototype = {
         this._counterLabel.set_text(count.toString());
     },
 
+    _updateCount: function() {
+        let count = this.notifications.length;
+        this._setCount(count, count > 1);
+    },
+
     setTransient: function(isTransient) {
         this.isTransient = isTransient;
     },
@@ -986,7 +991,11 @@ Source.prototype = {
                 this.notifications.splice(index, 1);
                 if (this.notifications.length == 0)
                     this._lastNotificationRemoved();
+
+                this._updateCount();
             }));
+
+        this._updateCount();
     },
 
     notify: function(notification) {
@@ -1023,6 +1032,8 @@ Source.prototype = {
         for (let i = this.notifications.length - 1; i >= 0; i--)
             if (!this.notifications[i].resident)
                 this.notifications[i].destroy();
+
+        this._updateCount();
     },
 
     // Default implementation is to destroy this source, but subclasses can override